package core

import (
	"go-learn/global"
	"go-learn/initialize"
)

type server interface {
	ListenAndServe() error
}

func RunServer() {
	// 初始化路由
	Router := initialize.Routers()
	port := global.Config.Server.Port
	var addr = ":"
	if port != "" {
		addr += port
	} else {
		// 默认端口
		addr += "8080"
	}
	err := Router.Run(addr)
	if err != nil {
		panic(err)
	}
}
